package com.sm.service;

import com.sm.dao.DynamicCollectMapper;
import com.sm.model.Dynamic;
import com.sm.model.DynamicCollect;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.time.LocalDateTime;
import java.util.Date;
import java.util.List;

@Service
public class DynamicCollectService {
    @Autowired
    private DynamicCollectMapper dynamicCollectMapper;
    //将收藏记录添加到数据库
    public void addDynamicCollect(DynamicCollect dynamicCollect) {
        dynamicCollect.setCreateTime(new Date());
        dynamicCollect.setUpdateTime(new Date());
        dynamicCollectMapper.addDynamicCollect(dynamicCollect);
    }
    //根据用户ID拉取此用户所有收藏记录
    public List<DynamicCollect> collectComment(Integer collectUser) {
        return dynamicCollectMapper.collectComment(collectUser);
    }
    //取消收藏接口：将这条收藏记录删除
    public void deleteCollect(Integer collectUser){
     dynamicCollectMapper.deleteCollect(collectUser);
    }
}
